<!-- 图片显示的公共组件 -->
<script setup>

const props = defineProps({
  imgUrl: {
    type: String,
  }
})

function showImg(img) {
  return import.meta.env.VITE_APP_BASE_API + img;
}
</script>

<template>
  <div>
    <el-tooltip v-if="imgUrl" class="box-item" effect="dark" placement="right-start">
      <template #content>
        <img alt="" :src="showImg(imgUrl)" width="100" height="100" />
      </template>
      <img alt="" :src="showImg(imgUrl)" width="30" height="30" />
    </el-tooltip>
    <div v-else class="el-image" style="width: 34px;height: 34px;">
      <div class="box">
        <i class="el-icon-picture" style="font-size: 18px; color: rgb(221, 221, 221);"></i>
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">
.el-image {
  .box {
    width: 100%;
    height: 100%;
    background-color: #f3f3f3;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
</style>